package com.rinlink.gateway.jt808.jt808;

import io.github.hylexus.jt808.converter.ResponseMsgBodyConverter;
import io.github.hylexus.jt808.msg.RequestMsgMetadata;
import io.github.hylexus.jt808.msg.RespMsgBody;
import io.github.hylexus.jt808.msg.resp.CommandMsg;
import io.github.hylexus.jt808.session.Jt808Session;

import javax.annotation.Nullable;
import java.util.Optional;

public class BytesResponseConverter implements ResponseMsgBodyConverter {
    @Override
    public boolean supportsMsgBody(Object msgBody) {
        return msgBody instanceof byte[] && ((CommandMsg)msgBody).getBody() instanceof CommandMsg;
    }

    @Override
    public Optional<RespMsgBody> convert(Object msgBody, @Nullable Jt808Session session, @Nullable RequestMsgMetadata metadata) {
       // byte[] body = (byte[]) ((CommandMsg)msgBody).getBody();
      //  return Optional.of(new BytesRespMsgBody(body));
        return null;
    }
}
